/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bean;

import java.util.Date;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.hibernate.Query;
import org.hibernate.Session;
import pojo.Report;
import pojo.Static;
import ulti.HibernateUtil;

/**
 *
 * @author phong
 */
public class Test {

    public static void main(String[] arg) {
        List<Report> reports = null;
        Session session = HibernateUtil.getSessionFactory().openSession();

        String hql = "from Report r where r.device.lab.id = :labID order by r.createDate desc";
        Query query = session.createQuery(hql);
        query.setString("labID", "LAB001");
        reports = query.list();
        System.out.println(reports.size());
        System.out.println("success");

    }
}
